<<!include:header>>

    <style>
        .smallNavLi {
            display: inline-block;
        }

        .btn-upload {
            position: relative;
            overflow: hidden;
        }

        .btn-upload input {
            position: absolute;
            top: 0;
            right: 0;
            margin: 0;
            padding: 0;
            font-size: 20px;
            cursor: pointer;
            opacity: 0;
            filter: alpha(opacity=0);
        }

        .btn-simple {
            color: #ffffff;
            padding: 5px 12px !important;
            margin-top: 10px;
            margin-left: 10px;
            display: flex;
            height: 35px
        }

        .containerCss {
            min-height: 800px;
            margin-right: 0px !important;
        }
    </style>
    <section class="hero-section litte-header">
        <div class="container">
            <div class="filtrate mb40 ft15    ">
                <div class="filtrate mb40 ft15   " style="margin-top:150px;color:#fff">

                </div>
            </div>
        </div>

    </section><!-- End Hero -->
    <div class="container" id="main">
        <div id="container" class="row containerCss">
            <div class="col-sm-12 col-md-2 col-lg-2 d-none d-lg-block" style="border-right: 2px solid #eeeeee;">

                <img src="" alt="我的头像" style="width: 100px;height: 100px; border-radius: 50%;margin: 20px;"
                    name="userFace" />

                <ul class="user-clone-nav " style="margin-top: 20px; margin-left: 5px;">
                    <li style="margin-top: 20px; margin-left: 5px; cursor: pointer;" onclick="displayItem('myInfo')">
                        个人资料
                    </li>
                    <li style="margin-top: 20px; margin-left: 5px; cursor: pointer;" onclick="displayItem('myCourse')">
                        我的课程
                    </li>
                    <li style="margin-top: 20px; margin-left: 5px; cursor: pointer;"
                        onclick="displayItem('liveCourse')">
                        直播课程
                    </li>
                    <li style="margin-top: 20px; margin-left: 5px; cursor: pointer;"
                        onclick="displayItem('myExercise')">
                        我的作业</li>
                    <li style="margin-top: 20px; margin-left: 5px; cursor: pointer;" onclick="displayItem('myWork')">
                        我的作品
                    </li>
                    <li style="margin-top: 20px; margin-left: 5px; cursor: pointer;"
                        onclick="displayItem('myWrongQuestion')"> 我的错题集</li>
                    <li style="margin-top: 20px; margin-left: 5px; cursor: pointer;" onclick="displayItem('myCoupon')">
                        我的优惠券</li>
                </ul>


            </div>

            <div class="col-sm-12 col-md-10 col-lg-10   " style="margin-top: 10px;margin-right: 0px !important;">
                <div class="row   d-lg-none d-sm-block d-md-block " style="margin-right: 0px !important;">
                    <div class="col-4" style="display: inline-block;">
                        <img src="" alt="我的头像" style="width: 100px;height: 100px; border-radius: 50%;" name="userFace">
                    </div>
                    <ul class="site-mobile-user-menu col-8  smallNavLi"></ul>
                </div>
                <div style=" min-height: 500px;">
                    <!-- 我的资料 -->
                    <div id="myInfo"
                        style=" min-height: 500px;  width: 100%;  position:absolute;; background-color:#ffffff;; ">
                        <div style="padding: 20px;" class="row" id="form">
                            <div class="form-group col-xs-6 col-sm-12 col-md-6 col-lg-6">
                                <label for="faceUI">&nbsp;&nbsp;</label>
                                <span class="btn btn-info btn-upload" style="width: 100%; border-radius: 5px;">点击修改头像
                                    <input type="file" id="faceUI" onchange="uploadFace(event)" accept="image/*"></span>
                            </div>
                            <div class="form-group col-xs-6 col-sm-12 col-md-6 col-lg-6">
                                <label for="usernameUI">昵称</label>
                                <input type="text" class="form-control" id="usernameUI" placeholder="昵称">
                            </div>

                            <div class="form-group col-xs-6 col-sm-12 col-md-6 col-lg-6">
                                <label for="creattimeUI">加入时间</label>
                                <span id="creattimeUI" class="form-control"></span>

                            </div>
                            <div class="form-group col-xs-6 col-sm-12 col-md-6 col-lg-6">
                                <label for="emailUI">邮箱</label>
                                <input type="email" class="form-control" id="emailUI" placeholder="邮箱">
                            </div>

                            <div class="form-group col-xs-6 col-sm-12 col-md-6 col-lg-6">
                                <label for="descriptionLabelUI">简介</label>
                                <input type="text" class="form-control" id="descriptionLabelUI" placeholder="简介">

                            </div>
                            <div class="form-group col-xs-6 col-sm-12 col-md-6 col-lg-6">
                                <label for="sexUI">性别</label>
                                <div class="form-control" style="  display: flex">
                                    <input type="radio"
                                        style="  margin-left: 50px;    height: 53px;    border: 1px solid #dae0e5"
                                        name="sexUI" value="男"> <label for="sexUI">男</label>
                                    <input type="radio"
                                        style=" margin-left: 50px;   height: 53px;    border: 1px solid #dae0e5"
                                        name="sexUI" value="女"> <label for="sexUI">女</label>
                                </div>
                            </div>
                            <div class="form-group col-xs-6 col-sm-12 col-md-6 col-lg-6">
                                <label for="telephoneUI">电话</label>
                                <input type="text" class="form-control" id="telephoneUI" placeholder="联系电话">
                            </div>
                            <div class="form-group col-xs-6 col-sm-12 col-md-6 col-lg-6">
                                <label for="WechatUI">微信</label>
                                <input type="text" class="form-control" id="WechatUI" placeholder="微信">
                            </div>
                            <div class="form-group col-xs-6 col-sm-12 col-md-6 col-lg-6">
                                <label for="idCardUI">身份证号</label>
                                <span id="idCardUI" class="form-control"></span>

                            </div>
                            <div class="form-group col-xs-6 col-sm-12 col-md-6 col-lg-6">
                                <label for="QqUI">QQ号码</label>
                                <input type="text" class="form-control" id="QqUI" placeholder="QQ号码">
                            </div>
                            <div class="form-group col-xs-12 col-sm-12 col-md-12 col-lg-12">
                                <label for="addressUI">礼品邮寄地址</label>
                                <input type="text" class="form-control" id="addressUI" placeholder="礼品邮寄地址">
                            </div>
                            <div class="form-group col-xs-6 col-sm-12 col-md-6 col-lg-6">
                                <button class="btn btn-success  " style="width: 100%;" class="form-control"
                                    onclick="saveInfo()">保存</button>
                            </div>

                        </div>
                    </div>
                    <!-- 我的课程 -->
                    <div id="myCourse"
                        style=" min-height: 300px;  width: 100%; position:absolute;; background-color:#ffffff;">


                        <div class="row  " style="margin-right: 0px !important;">

                            <li class="col-3 col-sm-4 col-md-3 col-lg-3 btn-simple " id="1div" onclick="getMyCourse(1)">
                                正在学习
                            </li>
                            <li class="col-4 col-sm-4 col-md-4 col-lg-4 btn-simple " id="3div" onclick="getMyCourse(3)">
                                即将学习
                            </li>
                            <li class="col-3 col-sm-4 col-md-3 col-lg-3 btn-simple " id="-1div"
                                onclick="getMyCourse(-1)">
                                过期课程 </li>
                        </div>
                        <div style=" background-color: #ffffff; margin-right: 10px !important;padding: 10px; margin-left: 10px;"
                            id="courseContainer">

                        </div>
                    </div>
                    <!-- 我的作业 -->
                    <div id="myExercise"
                        style=" min-height: 500px;  width: 100%; position:absolute;;background-color: #ffffff;">
                        <div style=" background-color: #ffffff; margin-right: 10px !important;padding: 10px; margin-left: 10px;"
                            id="exerciseContainer">

                        </div>
                    </div>
                    <!-- 直播课程 -->
                    <div id="liveCourse"
                        style=" min-height: 500px;  width: 100%; position:absolute;;background-color: #ffffff;">
                        <div style=" background-color: #ffffff; margin-right: 10px !important;padding: 10px;  margin-left: 10px;"
                            id="liveCourseContainer">
                            <div class="row" style="margin-top: 100px;">
                                <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6"> <span id="myTeacherUI"></span>
                                </div>
                                <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">您没有直播课 <span id="myTeacherUI"></span>
                                </div>


                            </div>

                        </div>
                    </div>

                    <!-- 我的作品 -->
                    <div id="myWork"
                        style=" min-height: 500px;  width: 100%;  position:absolute;;background-color: #ffffff;">
                        <div style=" background-color: #ffffff; margin-right: 10px !important;padding: 10px;  margin-left: 10px;"
                            id="workContainer">

                        </div>
                    </div>
                    <!-- 我的优惠券 -->
                    <div id="myCoupon"
                        style=" min-height: 500px;  width: 100%;  position:absolute;;background-color: #ffffff;">
                        <div style=" background-color: #ffffff; margin-right: 10px !important;padding: 10px; margin-left: 10px;"
                            id="couponContainer">

                        </div>
                    </div>
                    <!-- 我的错题集 -->
                    <div id="myWrongQuestion"
                        style=" min-height: 500px;  width: 100%;  position:absolute;;background-color: #ffffff;">
                        <div style=" background-color: #ffffff; margin-right: 10px !important;padding: 10px;  margin-left: 10px;"
                            id="wrongQuestionContainer">

                        </div>
                    </div>
                    <!-- 课程的试卷列表 -->
                    <div id="bookExercise"
                        style=" min-height: 500px;  width: 100%;  position:absolute;;background-color: #ffffff;">
                        <div style=" background-color: #ffffff; margin-right: 10px !important;padding: 10px;  margin-left: 10px;"
                            id="bookExerciseContainer">

                        </div>
                    </div>
                    <!-- 试卷 -->
                    <div id="exericseQuestion"
                        style=" min-height: 500px;  width: 100%;  position:absolute;;background-color: #ffffff;">
                        <div style=" background-color: #ffffff; margin-right: 10px !important;padding: 10px;  margin-left: 10px;"
                            id="exericseQuestionContainer">

                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>

    <div class="modal fade" id="exerciseQuestionResultModel" tabindex="-1" role="dialog"
        aria-labelledby="exerciseQuestionResultModelLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">
                        测试结果
                    </h4>
                </div>

                <div class="container">
                    <div class="row " style="margin:20px">
                        <div class="col-xs-4 col-md-4">试卷名称: </div>
                        <div class="col-xs-8 col-md-8" id="exerciseLabelUI"> </div>
                    </div>
                    <div class="row" style="margin:20px">
                        <div class="col-xs-4 col-md-4">总题数 </div>
                        <div class="col-xs-8 col-md-8" id="questionNumUI"> </div>
                    </div>
                    <div class="row" style="margin:20px; ">
                        <div class="col-xs-4 col-md-4">答题数:</div>
                        <div class="col-xs-8 col-md-8" id="answerNumUI"> </div>
                    </div>
                    <div class="row" style="margin:20px;  ">
                        <div class="col-3 ">正确数:</div>
                        <div class="col-3 " id="rightNumUI"> </div>
                        <div class="col-3 "> 得分</div>
                        <div class="col-3 " id="scoreUI"> </div>
                    </div>

                </div>
                <div class="modal-footer">
                    <div class="row" style="margin:20px">
                        <span>判断题对了得分，错了倒扣一半的分，不选择，不得分也不扣分</span>
                        <button type="button" class="btn btn-primary" onclick="closeExerciseQuestionModel()"> 知道了
                        </button>
                    </div>


                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
    <script src="/upload/1/platform/20230515/validate.js"></script>
    <script src="/upload/1/platform/20230515/aos.js"></script>
    <script src="/upload/1/platform/20230515/owl.carousel.min.js"></script>
    <script src="/upload/1/platform/20230515/jquery.sticky.js"></script>
    <script src="/upload/1/platform/20230515/jquery.easing.min.js"></script>
    <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
    <script src="/upload/1/platform/20230515/main.js"></script>
    <script>

        var exerciseChildren = [];


        // 格式化时间 ,displaytime 是否显示具体时间，1为显示，2为显示不显示秒，0为不显示
        function dateFormat(item, displaytime) {
            if (item) {
                var date = new Date(item * 1000)
                var year = date.getFullYear()
                var month = date.getMonth() + 1
                var day = date.getDate()
                var hour = date.getHours()
                var minute = date.getMinutes()
                var second = date.getSeconds()

                var str = `${year}-${month > 9 ? month : `0${month}`}-${day > 9 ? day : `0${day}`}`
                if (displaytime == 1) {
                    str = str + ` ${hour > 9 ? hour : `0${hour}`}:${minute > 9 ? minute : `0${minute}`}:${second > 9 ? second : `0${second}`}`
                } else if (displaytime == 2) {
                    str = str + ` ${hour > 9 ? hour : `0${hour}`}:${minute > 9 ? minute : `0${minute}`}`
                }
                return str
            }
        }


        var userInfo = {};
        function displayItem(divName) {
            document.getElementById("myInfo").setAttribute("style", "display:none;");
            document.getElementById("myCourse").setAttribute("style", "display:none;");
            document.getElementById("myExercise").setAttribute("style", "display:none;");
            document.getElementById("myWork").setAttribute("style", "display:none;");
            document.getElementById("liveCourse").setAttribute("style", "display:none;");
            document.getElementById("myCoupon").setAttribute("style", "display:none;");
            document.getElementById("myWrongQuestion").setAttribute("style", "display:none;");
            document.getElementById("exericseQuestion").setAttribute("style", "display:none;");
            document.getElementById("bookExercise").setAttribute("style", "display:none;");

            document.getElementById(divName).setAttribute("style", "display:block;  min-height: 500px;  width: 100%;background-color:#ffffff;position:absolute;")
            // document.getElementById("main").setAttribute("style", " height: " + (document.getElementById(divName).clientHeight + 100) + "px;")

            switch (divName) {
                case "myInfo":


                    getMyInfo();
                    break;
                case "myCourse":


                    getMyCourse(1);
                    break;
                case "myExercise":

                    getMyExercise();
                    break;
                case "myWork":

                    getMyWork();
                    break;
                case "myCoupon":

                    getMyCoupon();
                    break;
                case "myWrongQuestion":
                    getMyWrongQuestions();
                    break;
                case "bookExercise":

                    getMyCoupon();
                default:
                    break;
            }
        }
        displayItem("myInfo");
        function saveInfo() {
            userInfo.Username = document.getElementById("usernameUI").value
            userInfo.Email = document.getElementById("emailUI").value;
            userInfo.Qq = document.getElementById("QqUI").value;
            userInfo.Telephone = document.getElementById("telephoneUI").value;
            userInfo.Address = document.getElementById("addressUI").value;
          
            userInfo.Wechat = document.getElementById("WechatUI").value;
            userInfo.Description = document.getElementById("descriptionLabelUI").value;
            document.getElementsByName("sexUI").forEach(item => {
                if (item.checked == true) {
                    userInfo.Sex = item.value;
                }
            })
            axios.put('/api/student/update', userInfo, {
                headers: {
                    'Content-Type': 'application/json;charset=UTF-8',
                    'token': sessionStorage.getItem("token")
                },

            }).then(function (response) {
                var res = response.data;
                if (res.code != 200) {
                    alert(res.title)
                    return;
                }

                alert("保存成功");
            });
        }

        function uploadFace(e) {
            var formObj = new FormData()
            formObj.append('file', e.target.files[0])
            axios.post('/api/helper/uploadFile/student/' + userInfo.Platform, formObj, {
                headers: {
                    'Content-Type': 'multipart/form-data',
                    'token': sessionStorage.getItem("token")
                },

            }).then(function (response) {
                var res = response.data;
                if (res.code != 200) {
                    alert(res.title)
                    return;
                }
                document.getElementsByName("userFace").forEach(item => {
                    item.setAttribute("src", res.data)
                    userInfo.Face =res.data;
                })
                alert("上传成功,记得点保存");
            });

        }

        (function ($) {
            "use strict";

            var userNavClone = function () {
                $('.user-clone-nav').each(function () {
                    var $this = $(this);
                    $this.children().clone().addClass("smallNavLi").appendTo('.site-mobile-user-menu');
                });
            };
            userNavClone();


        })(jQuery);




        function getMyInfo() {
            axios.get('/api/student/info', {
                headers: {
                    'token': sessionStorage.getItem("token")
                }
            }).then(function (response) {
                var res = response.data;
                if (res.code != 200) {
                    alert(res.title)
                    if (res.code == 401) {
                        logOut();
                        window.location.href = "/"
                    }
                    return;
                }

                document.getElementsByName("userFace").forEach(item => {
                    item.setAttribute("src", res.data.Face)
                })
                userInfo = res.data;
                document.getElementById("usernameUI").value = userInfo.Username;
                document.getElementById("emailUI").value = userInfo.Email;
                document.getElementById("QqUI").value = userInfo.Qq;
                document.getElementById("telephoneUI").value = userInfo.Telephone;
                document.getElementById("creattimeUI").innerText = userInfo.RegisterTime;
                document.getElementById("addressUI").value = userInfo.Address;
                document.getElementById("WechatUI").value = userInfo.Wechat;
                document.getElementById("idCardUI").innerText = userInfo.Idcard;
                document.getElementById("descriptionLabelUI").value = userInfo.Description;
                document.getElementsByName("sexUI").forEach(item => {
                    if (item.value == userInfo.Sex) {
                        item.checked = true;
                    } else {
                        item.checked = false;
                    }
                })
            });

        }

        function getMyWrongQuestions() {
            axios.get('/api/exercise/getStudentWrongQuestions/0/0', {
                headers: {
                    'token': sessionStorage.getItem("token")
                }
            }).then(function (response) {
                var res = response.data;
                if (res.code != 200) {

                    alert(res.title)
                    return;
                }
                var resultHtml = "";

                if (!res.data) {
                    document.getElementById("wrongQuestionContainer").innerHTML = "没有数据";

                    return
                }


                for (var i = 0; i < res.data.length; i++) {
                    var item = res.data[i];
                    var actionLabel = "【单选题.";
                    switch (item.QuestionType) {
                        case 1:
                            actionUI = "  type='radio'"
                            actionLabel = "【单选题.";
                            break;
                        case 2:
                            actionUI = "  type='checkbox'"
                            actionLabel = "【多选题.";
                            break;
                        case 3:
                            actionUI = "  type='radio'"
                            actionLabel = "【判断题.";
                            break;
                        case 4:
                            actionUI = "  type='radio'"
                            break;
                        case 5:
                            actionUI = "  type='radio'"
                            break;
                        default:
                            break;
                    }
                    var xuanxiang = "";
                    if (item.A != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px; margin:20px;">  A:` + item.A + `  </div>`;
                    }
                    if (item.B != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px; margin:20px;">  B:` + item.B + `  </div>`;
                    }
                    if (item.C != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px; margin:20px;"> C:` + item.C + `  </div>`;
                    }
                    if (item.D != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px; margin:20px;">  D:` + item.D + `  </div>`;
                    }
                    if (item.E != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px; margin:20px;">  E:` + item.E + `  </div>`;
                    }
                    if (item.F != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px; margin:20px;">  F:` + item.F + `  </div>`;
                    }
                    if (item.G != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px; margin:20px;">  G:` + item.G + `  </div>`;
                    }
                    if (item.H != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px; margin:20px;">  H:` + item.H + `  </div>`;
                    }
                    if (item.I != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px; margin:20px;"> I:` + item.I + `  </div>`;
                    }
                    if (item.J != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px; margin:20px;">  J:` + item.J + `  </div>`;
                    } if (item.K != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px; margin:20px;">  K:` + item.K + `  </div>`;
                    }
                    resultHtml += ` <div class="row  d-none d-md-flex d-lg-flex" style="padding:20px;margin-top: 10px;width: 100%;"
                            id="exercise"`+ item.ID + `>
                            

                                <div class="col-12">
                                    <div class="row  " style="color: #b7a202; font-size: 18px; background-color:#f1f1f1;padding:10px;">
                                        <label style=" color: cadetblue; ">`+ actionLabel + item.QuestionScore + `分】</label>  <label >` + item.QuestionContent + `</label>
                                              </div>  `+ xuanxiang + ` 
                                        <div class="row  " style="color: darkcyan;font-size: 14px;">
                                        <div class="text-left" style="margin-left:40px"> 我的答案:`+ item.MyAnswer.toUpperCase() + ` </div>
                                        <div class="text-left" style="margin-left:40px"> 正确答案:`+ item.QuestionAnswer + ` </div>
                                    </div>
                                    <div class="row">
                            
                                        <div class="text-left" style="margin:20px" > 分析:`+ item.QuestionAnalyse + `  </div>
                            </div>
                                </div>
                               

                        </div>
                        <div class=" d-md-none d-lg-none d-sm-flex d-xs-flex " style="padding:20px; margin-top:10px; ">
                            <div class=" row   " style="color: #b7a202; font-size: 18px; background-color:#f1f1f1;padding:10px;">
                       
                             
                                <label style=" color: cadetblue; ">`+ actionLabel + item.QuestionScore + `分】</label>  <label >` + item.QuestionContent + `</label>
 
                             
                            </div>

                            <div class="row" style="color:slategrey;font-size: 14px; margin-top:20px;margin-bottom: 20px;">
                                `+ xuanxiang + ` 
                            </div>
                            <div class="row"  style="color: darkcyan;font-size: 14px;">
                                <div class="text-left" style="margin-left:40px"> 我的答案:`+ item.MyAnswer.toUpperCase() + ` </div>
                                        <div class="text-left"style="margin-left:40px"> 正确答案:`+ item.QuestionAnswer + ` </div>
                            </div>
                            <div class="row">
                                
                                <div class="text-left"style="margin:20px"> 分析:`+ item.QuestionAnalyse + ` </div>
                                      
                            </div>
                        </div>`;
                }
                document.getElementById("wrongQuestionContainer").innerHTML = resultHtml;
            });

        }

        function getMyCourse(kind) {
            document.getElementById(1 + "div").setAttribute("style", "background-color:#ffc107")
            document.getElementById(3 + "div").setAttribute("style", "background-color:#ffc107")
            document.getElementById(-1 + "div").setAttribute("style", "background-color:#ffc107")
            document.getElementById(kind + "div").setAttribute("style", "background-color:#28a745")
            axios.get('/api/student/queryMyCourse?kind=' + kind + '&limit=1000&offset=0&desc=1', {
                headers: {
                    'token': sessionStorage.getItem("token")
                }
            }).then(function (response) {
                var res = response.data;
                if (res.code != 200) {

                    alert(res.title)
                    return;
                }
                var courseList = res.data;
                var courseHtml = "";


                if (!res.data) {
                    document.getElementById("courseContainer").innerHTML = "没有数据";

                    return
                }
                var displayStr = "block";
                switch (kind) {
                    case 1:
                        displayStr = "block"
                        break;
                    case 3:
                        displayStr = "none"
                        break;
                    case -1:
                        displayStr = "none"
                        break;

                    default:
                        break;
                }


                for (var i = 0; i < courseList.length; i++) {
                    var item = courseList[i];
                    courseHtml += ` <div class="row  d-none d-md-flex d-lg-flex" style="padding:20px;margin-top: 10px;width: 100%; background-color:#f1f1f1"
                            id="course"`+ item.ID + `>
                            <div class="col-3">
                                <img id="courseImg"
                                    src="`+ item.Image + `"
                                    alt="课程图片" style="margin-top:20px;max-height: 100px;  max-width: 100%;">
                            </div>
                            <div class="col-9 row"> 
                                <div class="col-9">
                                    <div class="row  " style="color: #b7a202; font-size: 18px;">
                                        <p class="text-center">`+ item.LabelName + `</p>
                                    </div>
                                    <div class="row  "
                                        style="color:slategrey;font-size: 14px; margin-top:20px;margin-bottom: 20px;">
                                        <p class="text-left"> 购买时间:`+ item.AddTime + `.</p>
                                      
                                    </div>
                                    <div class="row  " style="color: darkcyan;font-size: 14px;">
                                        <p class="text-left"> 有效期:`+ item.StartTime + `-` + item.EndTime + ` </p>
                                    </div>
                                </div>
                                <div class="col-3" style="display:`+ displayStr + `" >
                                    <div class="row  " style="color: darkcyan;font-size: 14px;">
                                        <button class="btn-simple " style="background-color:#ffc107"   onclick="gotoCourse(` + item.CourseID + `) ">继续学习</button>
                                
                                    </div>
                                    <div class="row  " style="color: darkcyan;font-size: 14px;">
                                        <button class="btn-simple " style="background-color:#28a745"  onclick="gotoCourseExericse(` + item.CourseID + `) ">试卷题库</button>
                               
                                    </div>
                                
                                </div>
                            </div>

                        </div>
                        <div class=" d-md-none d-lg-none d-sm-flex d-xs-flex " style="padding-left: 10px; margin-top:10px;background-color:#f1f1f1">
                            <div class=" row  ">
                                <img id="courseImg" src="`+ item.Image + `"
                                    alt="课程图片" style="max-height: 100%; max-width: 100%; ">
                                <div>
                                    <p class="text-left " style="margin: 10px;">`+ item.LabelName + `</p>
 
                                </div>
                            </div>

                            <div class="row">
                                <span class="text-left" style="margin:10px ;"> 购买时间:`+ item.AddTime + ` </span>

                            </div>
                            <div class="row">
                                <span class="text-left"  style="margin:10px ;"> 有效期:`+ item.StartTime + `  </span>
                            </div>
                            <div class="row"  >
                                <span class="text-left"  style="margin:10px ;">到   ` + item.EndTime + ` </span>
                            </div>
                            <div class="row"  style="margin:10px ; display:`+ displayStr + `"  >
                                <button class="btn-simple " style="background-color:#ffc107"  onclick="gotoCourse(`+ item.CourseID + `) ">继续学习</button>
                             </div>
                             <div class="row  " style="margin-top:30px ;display:`+ displayStr + `" >
                                    <button class="btn-simple "  style="background-color:#28a745"   onclick="gotoCourseExericse(` + item.CourseID + `) ">试卷题库</button>
                               
                              </div>

                        </div>`;
                }
                document.getElementById("courseContainer").innerHTML = courseHtml;

            });

        }

        //进入直播
        function gotoZhiBo() {
            alert("本课程暂无直播")
        }
        function gotoCourse(courseid) {
            window.location.href = "/videoPlayer?id=" + courseid

        }
        function gotoCourseExericse(courseid) {
            displayItem("bookExercise")
            axios.get('/api/exercise/getCourseExercise/' + courseid + '?limit=1000&offset=0', {
                headers: {
                    'token': sessionStorage.getItem("token")
                }
            }).then(function (response) {
                var res = response.data;
                if (res.code != 200) {

                    alert(res.title)
                    return;
                }
                var exerciseList = res.data;
                var courseHtml = "";


                if (!res.data) {
                    document.getElementById("bookExerciseContainer").innerHTML = "没有数据";

                    return
                }

                for (var i = 0; i < exerciseList.length; i++) {
                    var item = exerciseList[i];
                    courseHtml += ` <div class="row  d-none d-md-flex d-lg-flex" style="padding:20px;margin-top: 10px;width: 100%; background-color:#f1f1f1"
                            id="course"`+ item.ID + `>
                            
                                <div class="col-9">
                                    <div class="row  " style="color: #b7a202; font-size: 18px;">
                                        <p class="text-center">`+ item.Label + `</p>
                                    </div>
                            
                                </div>
                                <div class="col-3"   >
                                    <div class="row  " style="color: darkcyan;font-size: 14px;">
                                        <button class="btn-simple " style="background-color:#ffc107"   onclick="gotoExercise(` + item.Id + `) ">开始做题</button>
                                
                                    </div>
                                    
                                
                                </div> 

                        </div>
                        <div class=" d-md-none d-lg-none d-sm-flex d-xs-flex " style="padding-left: 10px; margin-top:10px;background-color:#f1f1f1">
                            <div class=" row  ">
                               
                                    <p class="text-left " style="margin: 10px;">`+ item.Label + `</p>
 
                               
                            </div>
 
                           
                             <div class="row  " >
                                    <button class="btn-simple  " style="background-color:#ffc107"   onclick="gotoExercise(` + item.Id + `) ">开始做题</button>
                               
                              </div>

                        </div>`;
                }
                document.getElementById("bookExerciseContainer").innerHTML = courseHtml;

            });
        }
        function gotoExercise(exerciseID) {
            displayItem("exericseQuestion")
            getExercieQuestions(exerciseID)

        }
        function gotoWork(courseid) {
            displayItem("")


        }
        function getMyExercise() {
            axios.get('/api/exercise/getSudentDoExerciseList?limit=10&offset=0', {
                headers: {
                    'token': sessionStorage.getItem("token")
                }
            }).then(function (response) {
                var res = response.data;
                if (res.code != 200) {

                    alert(res.title)
                    return;
                }
                var resultHtml = "";
                if (!res.data) {
                    document.getElementById("exerciseContainer").innerHTML = "没有数据";

                    return
                }



                for (var i = 0; i < res.data.length; i++) {
                    var item = res.data[i];
                    var doLabel = ` <button class="btn-simple "  style="background-color:#17a2b8"  onclick="gotoExercise(` + item.ExerciseID + `) ">开始做</button>`;
                    if (item.State != 0) {
                        doLabel = ` <button class="btn-simple "  style="background-color:#ffc107"   onclick="gotoExercise(` + item.ExerciseID + `) ">重新做</button>`;
                    }
                    resultHtml += ` <div class="row  d-none d-md-flex d-lg-flex" style="padding:20px;margin-top: 10px;width: 100%; background-color:#f1f1f1"
                            id="exercise"`+ item.ID + `>
                            

                                <div class="col-10">
                                    <div class="row  " style="color: #b7a202; font-size: 18px;">
                                        <p class="text-center">`+ item.Label + `</p>
                                    </div>
                                    <div class="row  "
                                        style="color:slategrey;font-size: 14px; margin-top:20px;margin-bottom: 20px;">
                                        <p class="text-left"> 正确数:`+ item.RightNum + `.</p>
                                        <p class="text-left"> 总题数:`+ item.TotalNum + `.</p>
                                        <p class="text-left"> 得分:`+ item.Score + `.</p>
                                    </div>
                                    <div class="row  " style="color: darkcyan;font-size: 14px;">
                                        <p class="text-left"> 完成时间:`+ dateFormat(item.StartTime, true) + `-` + dateFormat(item.EndTime, true) + ` </p>
          
                                    </div>
                                </div>
                                <div class="col-2">
                         ` + doLabel + `  
                                </div>
                   

                        </div>
                        <div class=" d-md-none d-lg-none d-sm-flex d-xs-flex " style="padding: 20px; margin-top:10px;background-color:#f1f1f1">
                            <div class=" row  ">
                       
                             
                                    <p class="text-left " style="color: #b7a202; font-size: 18px;">`+ item.Label + `</p>
 
                             
                            </div>

                            <div class="row"   style="color:slategrey;font-size: 14px; margin-top:20px;margin-bottom: 20px;">
                                <span class="text-left"  > 正确数:`+ item.RightNum + `.</span>
                                 <span class="text-left"> 总题数:`+ item.TotalNum + `.</span>
                                 <span class="text-left"> 得分:`+ item.Score + `.</span>
                            </div>
                            <div class="row" style="color: darkcyan;font-size: 14px;">
                                <p class="text-left"> 完成时间:`+ dateFormat(item.StartTime, true) + ` </p>
                            </div>
                            <div class="row"  style="color: darkcyan;font-size: 14px;">
                                <span class="text-left"  >到   ` + dateFormat(item.EndTime, true) + ` </span>
                            </div>
                            <div class="row" >
                                ` + doLabel + ` 
                             
                            </div>


                        </div>`;
                }
                document.getElementById("exerciseContainer").innerHTML = resultHtml;
            });

        }
        function getExercieQuestions(exericseID) {
            axios.get('api/exercise/getExerciseQuestion/' + exericseID + '?simple=false', {
                headers: {
                    'token': sessionStorage.getItem("token")
                }
            }).then(function (response) {
                var res = response.data;
                if (res.code != 200) {

                    alert(res.title)
                    return;
                }
                if (!res.data || !res.data.List) {
                    document.getElementById("exerciseContainer").innerHTML = "没有数据";

                    return
                }
                exerciseAnswerObj = {};

                var resultHtml = `   <div class="row "   style=" margin:20px;">
                            <div class="col-12" >
                             <div class="row text-center "   style="color:brown;font-size: 18px;"   >  <span style="width:100%"> `+ res.data.Label + ` </span></div>
                             <div class="row  text-center"   style=" font-size: 14px;"   >   <span style="width:100%"> 考试时间:`+ res.data.Examtime + `分钟 </span>  </div>
                            </div>
                            
                            </div>`;

                for (var i = 0; i < res.data.List.length; i++) {
                    var item = res.data.List[i];
                    var actionUI = "";
                    var actionLabel = "【单选题.";
                    switch (item.QuestionType) {
                        case 1:
                            actionUI = "  type='radio'"
                            actionLabel = "【单选题.";
                            break;
                        case 2:
                            actionUI = "  type='checkbox'"
                            actionLabel = "【多选题.";
                            break;
                        case 3:
                            actionUI = "  type='radio'"
                            actionLabel = "【判断题.";
                            break;
                        case 4:
                            actionUI = "  type='radio'"
                            break;
                        case 5:
                            actionUI = "  type='radio'"
                            break;
                        default:
                            break;
                    }
                    var xuanxiang = "";

                    if (item.A != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px; margin:20px;">  <input onchange="onQuestionChange(this,` + item.QuestionType + `,` + item.Id + `,this.value )" style='margin-top:4px;margin-right:10px;' ` + actionUI + ` name="question_` + item.Id + `" value='A'  /> A:` + item.A + `  </div>`;
                    }
                    if (item.B != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px; margin:20px;">  <input onchange="onQuestionChange(this,` + item.QuestionType + `,` + item.Id + `,this.value )" style='margin-top:4px;margin-right:10px;' ` + actionUI + `name="question_` + item.Id + `"value='B'  />B:` + item.B + `  </div>`;
                    }
                    if (item.C != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px;  margin:20px;">  <input onchange="onQuestionChange(this,` + item.QuestionType + `,` + item.Id + `,this.value )" style='margin-top:4px;margin-right:10px;' ` + actionUI + `name="question_` + item.Id + `"value='C'  />C:` + item.C + `  </div>`;
                    }
                    if (item.D != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px;  margin:20px;">  <input onchange="onQuestionChange(this,` + item.QuestionType + `,` + item.Id + `,this.value )" style='margin-top:4px;margin-right:10px;' ` + actionUI + `name="question_` + item.Id + `"value='D'  /> D:` + item.D + `  </div>`;
                    }
                    if (item.E != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px; margin:20px;">  <input onchange="onQuestionChange(this,` + item.QuestionType + `,` + item.Id + `,this.value )" style='margin-top:4px;margin-right:10px;' ` + actionUI + `name="question_` + item.Id + `"value='E'  />E:` + item.E + `  </div>`;
                    }
                    if (item.F != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px;  margin:20px;">  <input onchange="onQuestionChange(this,` + item.QuestionType + `,` + item.Id + `,this.value )" style='margin-top:4px;margin-right:10px;' ` + actionUI + `name="question_` + item.Id + `"value='F'  /> F:` + item.F + `  </div>`;
                    }
                    if (item.G != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px;  margin:20px;">  <input onchange="onQuestionChange(this,` + item.QuestionType + `,` + item.Id + `,this.value )" style='margin-top:4px;margin-right:10px;' ` + actionUI + `name="question_` + item.Id + `"value='G'  /> G:` + item.G + `  </div>`;
                    }
                    if (item.H != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px; margin:20px;">  <input onchange="onQuestionChange(this,` + item.QuestionType + `,` + item.Id + `,this.value )" style='margin-top:4px;margin-right:10px;' ` + actionUI + `name="question_` + item.Id + `"value='H'  />H:` + item.H + `  </div>`;
                    }
                    if (item.I != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px;  margin:20px;">  <input onchange="onQuestionChange(this,` + item.QuestionType + `,` + item.Id + `,this.value )" style='margin-top:4px;margin-right:10px;' ` + actionUI + `name="question_` + item.Id + `"value='I'  /> I:` + item.I + `  </div>`;
                    }
                    if (item.J != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px;  margin:20px;">  <input onchange="onQuestionChange(this,` + item.QuestionType + `,` + item.Id + `,this.value )" style='margin-top:4px;margin-right:10px;' ` + actionUI + `name="question_` + item.Id + `"value='J'  />J:` + item.J + `  </div>`;
                    } if (item.K != "") {
                        xuanxiang += `    <div class="row  "    style="color:slategrey;font-size: 14px; margin:20px;">  <input onchange="onQuestionChange(this,` + item.QuestionType + `,` + item.Id + `,this.value )" style='margin-top:4px;margin-right:10px;' ` + actionUI + `name="question_` + item.Id + `"value='K'  />K:` + item.K + `  </div>`;
                    }

                    resultHtml += ` <div class="row  d-none d-md-flex d-lg-flex" style="padding:20px;margin-top: 10px;width: 100%;"
                            id="exercise"`+ item.ID + `>
                            

                                <div class="col-12">
                                    <div class="row  " style="color: #b7a202; font-size: 18px; background-color:#f1f1f1;padding:10px;">
                                        <label style=" color: cadetblue; ">`+ actionLabel + item.QuestionScore + `分】</label>  <label >` + item.QuestionContent + `</label>
                                    </div>
                                  
                                     `+ xuanxiang + ` 
                                   
                                    <div class="row  " style="color: darkcyan;font-size: 14px;">
                                     
                                    </div>
                                </div>
                               
                   

                        </div>
                        <div class=" d-md-none d-lg-none d-sm-flex d-xs-flex " style="padding: 20px; margin-top:10px;background-color:#f1f1f1">
                            <div class="row  " style="color: #b7a202; font-size: 18px; background-color:#f1f1f1;padding:10px;">
                                        <label style=" color: cadetblue; ">`+ actionLabel + item.QuestionScore + `分】</label>  <label >` + item.QuestionContent + `</label>
                                    </div> 
                                `+ xuanxiang + `  
                            <div class="row"  style="color: darkcyan;font-size: 14px;">
                              
                            </div> 

                        </div>`;
                }
                resultHtml += `   <div class="row  text-center"     >   <button  onclick="submitExercise(` + res.data.Id + `)" type="button" class="btn btn-success">做完了.交卷</button>  </div> `;
                document.getElementById("exericseQuestionContainer").innerHTML = resultHtml;
            });
        }
        var exerciseAnswerObj = {};

        function onQuestionChange(inputUI, questionKind, questionID, value) {
            if (questionKind == 2) {
                //多项选择
                if (inputUI.checked == false && exerciseAnswerObj[questionID]) {
                    var otherValues = [];
                    for (var i = 0; i < exerciseAnswerObj[questionID].length; i++) {
                        if (exerciseAnswerObj[questionID][i] != value) {
                            otherValues.push(exerciseAnswerObj[questionID][i])
                        }
                    }
                    if (otherValues.length == 0) {
                        delete exerciseAnswerObj[questionID];
                    } else {
                        exerciseAnswerObj[questionID] = otherValues;
                    }


                } else {
                    if (exerciseAnswerObj[questionID]) {
                        exerciseAnswerObj[questionID].push(value)
                    } else {
                        exerciseAnswerObj[questionID] = [value];
                    }
                }
            } else {

                exerciseAnswerObj[questionID] = [value];
            }

        }

        function submitExercise(exerciseID) {
            var answerList = [];
            for (var key in exerciseAnswerObj) {
                var item = {};
                item.Id = parseInt(key)

                item.Answer = exerciseAnswerObj[key].toString();
                answerList.push(item)

            }

            axios.post('/api/exercise/correctExercise/' + exerciseID, { Children: answerList, StartTime: parseInt(new Date().getTime() / 1000) }, {
                headers: {
                    'token': sessionStorage.getItem("token")
                }
            }).then(function (response) {
                var res = response.data;
                if (res.code != 200) {
                    alert(res.title)
                    return;
                }


                document.getElementById("exerciseLabelUI").innerHTML = res.data.Label;
                document.getElementById("questionNumUI").innerHTML = res.data.TotalNum;
                document.getElementById("answerNumUI").innerHTML = res.data.AnswerNum;
                document.getElementById("rightNumUI").innerHTML = res.data.RightNum;
                document.getElementById("scoreUI").innerHTML = res.data.Score;
                $('#exerciseQuestionResultModel').modal('show');




            });
        }
        function closeExerciseQuestionModel() {
            $('#exerciseQuestionResultModel').modal('hide');
        }
        function getMyWork() {
            axios.get('/api/class/getMyStudentWorks/all?limit=5&offset=0&workname=', {
                headers: {
                    'token': sessionStorage.getItem("token")
                }
            }).then(function (response) {
                var res = response.data;
                if (res.code != 200) {
                    alert(res.title)
                    return;
                }
                var resultHtml = "";
                if (!res.data) {
                    document.getElementById("workContainer").innerHTML = "没有数据";
                    return
                }

                for (var i = 0; i < res.data.length; i++) {
                    var item = res.data[i];
                    resultHtml += ` <div class="row  d-none d-md-flex d-lg-flex" style="padding:20px;margin-top:10px;width: 100%; background-color:#f1f1f1"
                            id="work"`+ item.Id + `>
                           
                         

                                <div class="col-9">
                                    <div class="row  " style="color: #b7a202; font-size: 18px;">
                                        <p class="text-center">`+ item.WorkName + `</p>
                                    </div>
                                    <div class="row  "
                                        style="color:slategrey  margin-top:20px;margin-bottom: 20px;">
                                        <span class="text-left" style="margin-right:20px" > 班级:`+ item.ClassLabel + `.</span>
                                        <span class="text-left"> 描述:`+ item.Description + `.</span>
                                       
                                    </div>
                                    <div class="row  ">
                                        <p class="text-left" style="color: #f1a202;  "> 老师点评:`+ item.Reply + `.</p>

                                        </div>
                                    <div class="row  " style="color: darkcyan; ">
                                        <p class="text-left" style="margin-right:20px"> 创建时间:`+ dateFormat(item.Createtime, true) + ` </p>
                                        <p class="text-left"> 辅导老师:`+ item.TeacherLabel + ` </p>
                                    </div>
                                </div>
                                <div class="col-3">
                                    <button class="btn-simple " style="background-color:#ffc107"    onclick="gotoWork(`+ item.Id + `) ">打开</button>
                                     
                                </div> 

                        </div>
                        <div class=" d-md-none d-lg-none d-sm-flex d-xs-flex " style="padding: 20px; margin-top:10px;background-color:#f1f1f1">
                            <div class=" row  " style="color: #b7a202; font-size: 18px;">
                       
                             
                                    <p class="text-left "  >`+ item.WorkName + `</p>
 
                             
                            </div>

                            <div class="row"> 
                                <p class="text-left"> 班级:`+ item.ClassLabel + `.</p>
                                        <p class="text-left"> 描述:`+ item.Description + `.</p>
                                        <p class="text-left"> 老师点评:`+ item.Reply + `.</p>
                            </div>
                            <div class="row">
                                <p class="text-left"> 创建时间:`+ dateFormat(item.Createtime, true) + ` </p>
                            </div>
                            <div class="row"  >
                             
                                <p class="text-left"> 辅导老师:`+ item.TeacherLabel + ` </p>
                            </div>
                            <div class="row" >
                                <button class="btn-simple " style="background-color:#ffc107;margin:10px ;"  onclick="gotoWork(`+ item.Id + `) ">打开</button>
                             
                            </div> 
                        </div>`;
                }
                document.getElementById("workContainer").innerHTML = resultHtml;
            });

        }
        function getMyCoupon() {
            axios.get('/api/student/myLuck?limit=10&offset=0', {
                headers: {
                    'token': sessionStorage.getItem("token")
                }
            }).then(function (response) {
                var res = response.data;
                if (res.code != 200) {

                    alert(res.title)
                    return;
                }
                var resultHtml = "";
                if (!res.data) {
                    document.getElementById("couponContainer").innerHTML = "没有优惠券";

                    return
                }

                for (var i = 0; i < res.data.length; i++) {
                    var item = res.data[i];
                    resultHtml += ` <div class="row  d-none d-md-flex d-lg-flex" style="padding:20px;margin-top: 10px;width: 100%; background-color:#f1f1f1"
                            id="exercise"`+ item.ID + `>
                           
                            <div class="col-9 row">

                                <div class="col-9">
                                    <div class="row  " style="color: #b7a202; font-size: 18px;">
                                        <p class="text-center">额度:`+ item.Price + `</p>
                                    </div>
                                    <div class="row  "
                                        style="color:slategrey;font-size: 14px; margin-top:20px;margin-bottom: 20px;">
                                        <p class="text-left"> 数量:×`+ item.Num + `.</p>
                                        <p class="text-left"> 总题数:`+ item.TotalNum + `.</p>
                                        <p class="text-left"> 备注:满`+ item.Fazhi + `元时候可使用</p>
                                    </div>
                                    <div class="row  " style="color: darkcyan;font-size: 14px;">
                                        <p class="text-left"> 有效期:`+ item.StartTimeStr + `-` + item.EndTimeStr + ` </p>
 
                                    </div>
                                </div>
                               
                            </div>

                        </div>
                        <div class=" d-md-none d-lg-none d-sm-flex d-xs-flex " style="padding-left: 10px; margin-top:10px;background-color:#f1f1f1">
                            <div class=" row  ">
                       
                             
                                    <p class="text-left " style="margin: 10px;">`+ item.Price + `</p>
 
                             
                            </div>

                            <div class="row"> 
                                <p class="text-left"> 数量:×`+ item.Num + `.</p>
                                        <p class="text-left"> 总题数:`+ item.TotalNum + `.</p>
                                        <p class="text-left"> 备注:满`+ item.Fazhi + `元时候可使用</p>
                            </div>
                            <div class="row">
                                <p class="text-left"> 有效期:`+ item.StartTimeStr + ` </p>
                            </div>
                            <div class="row"  >
                                <span class="text-left"  style="margin:10px ;">到   ` + item.EndTimeStr + ` </span>
                            </div>
                           


                        </div>`;
                }
                document.getElementById("couponContainer").innerHTML = resultHtml;
            });

        }


    </script>